Skip to content

feat(code): add diff source selector#1785

Merged
adboio merged 1 commit intomainfrom
04-21-feat_code_add_diff_source_selector
Apr 22, 2026
Merged

feat(code): add diff source selector#1785
adboio merged 1 commit intomainfrom
04-21-feat_code_add_diff_source_selector

Conversation

@adboio
Copy link
Copy Markdown
Contributor

@adboio adboio commented Apr 21, 2026

Problem

for local tasks we only show one diff - just the local diff state

this means when you push changes or open a PR, the diff panel becomes empty

Changes

adds a new diff source selector dropdown menu

right now it has two options:

  1. local (what we had already)
  2. branch vs. default

this will include "PR" as an option soon!

Screenshot 2026-04-21 at 4.06.41 PM.png
Screenshot 2026-04-21 at 4.06.43 PM.png

How did you test this?

manully

Copy link
Copy Markdown
Contributor Author

adboio commented Apr 21, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@adboio adboio requested a review from a team April 21, 2026 20:17
@adboio adboio marked this pull request as ready for review April 21, 2026 20:19
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 21, 2026

Prompt To Fix All With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/code-review/utils/resolveDiffSource.test.ts
Line: 1-96

Comment:
**Prefer parameterised tests**

All 8 test cases call the same function with different inputs — this is exactly what `it.each` is for. Per the team's standard, parameterised tests are preferred.

```ts
describe("resolveDiffSource", () => {
  it.each([
    // heuristic (no user choice)
    { configured: null, hasLocalChanges: true,  linkedBranch: "feat/x", aheadOfDefault: 3, expected: "local",  desc: "uncommitted changes → local" },
    { configured: null, hasLocalChanges: false, linkedBranch: "feat/x", aheadOfDefault: 2, expected: "branch", desc: "clean tree with commits ahead → branch" },
    { configured: null, hasLocalChanges: false, linkedBranch: null,     aheadOfDefault: 0, expected: "local",  desc: "no linked branch → local" },
    { configured: null, hasLocalChanges: false, linkedBranch: "feat/x", aheadOfDefault: 0, expected: "local",  desc: "no commits ahead → local" },
    // explicit override
    { configured: "local",  hasLocalChanges: false, linkedBranch: "feat/x", aheadOfDefault: 5, expected: "local",  desc: "explicit local respected even when branch available" },
    { configured: "branch", hasLocalChanges: true,  linkedBranch: "feat/x", aheadOfDefault: 1, expected: "branch", desc: "explicit branch respected when available" },
    { configured: "branch", hasLocalChanges: false, linkedBranch: null,     aheadOfDefault: 0, expected: "local",  desc: "explicit branch falls back to local (no linked branch)" },
    { configured: "branch", hasLocalChanges: false, linkedBranch: "feat/x", aheadOfDefault: 0, expected: "local",  desc: "explicit branch falls back to local (no commits ahead)" },
  ] as const)("$desc", ({ configured, hasLocalChanges, linkedBranch, aheadOfDefault, expected }) => {
    expect(resolveDiffSource({ configured, hasLocalChanges, linkedBranch, aheadOfDefault })).toBe(expected);
  });
});
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: apps/code/src/renderer/features/code-review/components/ReviewPage.tsx
Line: 201-211

Comment:
**Misleading empty state when `repoSlug` is unavailable**

When `repoInfo` is `undefined` (e.g., `useGitQueries` hasn't resolved yet or the remote origin is unset), `repoSlug` is `null` and the query is disabled. `files` stays as `EMPTY_BRANCH_FILES`, so `isLoading` is `false` and `isEmpty` is `true`, causing "No file changes to review" to appear — even though the real issue is that the repo slug couldn't be determined. A user who has commits ahead of default would see this and think the feature is broken.

Consider checking `!repoSlug` explicitly and rendering a distinct message, or keeping `isLoading={isLoading || (!repoSlug && isReviewOpen)}` to show the spinner while metadata is still resolving.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "feat(code): add diff source selector" | Re-trigger Greptile

@adboio adboio force-pushed the 04-21-feat_code_add_diff_source_selector branch from b07d98d to d32d00a Compare April 22, 2026 14:34
Copy link
Copy Markdown
Contributor

@jonathanlab jonathanlab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lfg

One note: it took me a few seconds to understand what we meant by default, but that might just be me. I usually call it trunk or similar. Or we can derive the trunk branch and say vs main/master/{$TRUNK}.

Copy link
Copy Markdown
Contributor Author

adboio commented Apr 22, 2026

@jonathanlab good looks, thank you! i'll update this

@adboio adboio force-pushed the 04-21-feat_code_add_diff_source_selector branch from d32d00a to 768a644 Compare April 22, 2026 15:27
@adboio adboio merged commit 91667fd into main Apr 22, 2026
16 checks passed
Copy link
Copy Markdown
Contributor Author

adboio commented Apr 22, 2026

Merge activity

@adboio adboio deleted the 04-21-feat_code_add_diff_source_selector branch April 22, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants